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lyVYV0yzofvJqkbTHnhMD8uQGys='
// 加密
export function encrypt (txt) {
  const tmp = new JSEncrypt()
  tmp.setPublicKey(PUB_KEY)
  return tmp.encrypt(txt)
}
// 解密
export function decrypt (txt) {
  const tmp = new JSEncrypt()
  tmp.setPrivateKey(PRI_KEY)
  return tmp.decrypt(txt)
}
